const mongoose = require('mongoose');
//连接数据库
async function main() {
    return await mongoose.connect('mongodb://127.0.0.1:27017/SkHomeWork')
}
main()
.then(()=>{
    console.log('数据库连接成功');
})
.catch(err=>{
    console.log('数据库连接失败');
    console.log(err);
})

module.exports = {
    StuModel:mongoose.model('Student',require('./StuModel')),
    TeaModel:mongoose.model('Teacher',require('./TeaModel')),
    classModel:mongoose.model('Class',require('./classManger')),
    menuModel:mongoose.model('Menu',require('./menuModel')),
    BtnModel:mongoose.model('Button',require('./btnModel')),
    jobModel:mongoose.model('Job',require('./jobModel')),
    jobAdnMenuModel:mongoose.model('JobAndMenu',require('./JobAndMenuModel')),
    jobAndBtnModel:mongoose.model('JobAndBtn',require('./jobAndBtnModel')),
    TeaAndClassModel:mongoose.model('TeacherAndClass',require('./TeaAndClassModel')),
    FileModel:mongoose.model('File',require('./fileModel')),
    UploadModel:mongoose.model('Upload',require('./uploadModel')),
    HomeWorkModel:mongoose.model('HomeWork',require('./homeWorkModel')),
    StudentWorkModel:mongoose.model('StudentWork',require('./studentWorkModel'))
}